home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / HyperHackers.cpt / Hyper-Hackers Queue 1.0 / card_34877.txt < prev    next >
Text File  |  1989-02-26  |  2KB  |  76 lines

  1. -- card: 34877 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3797
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 1
  9. ----- text -----
  10.  
  11. From: john@felix.UUCP (John Gilbert)
  12.  
  13. Date: 8 Mar 88 20:00:56 GMT
  14.  
  15. >I hope someone can point out my stupidity, or at least tell me that
  16. >the same thing doesn't happen with them.  Otherwise, the limited
  17. >inheritance in HyperTalk is even more crippled.
  18.  
  19. >    *    Create a new field and put some numbers separated by commas in
  20. >    it.  I had 5 items in a card field in an otherwise empty
  21. >    stack.
  22.  
  23. >    *    Now add the following script to the field:
  24.  
  25. >        on test
  26. >           put item 2 of the target
  27. >        end test
  28.  
  29. >    *    Stare in dismay as nothing gets put in the message box when
  30. >    you do a <<send "test" to card field 'blort'>> via the message
  31. >    box.
  32.  
  33. The problem here is that the expression "the target" evaluates to a string
  34. containing the name of the target, and the binding is such that it does 
  35. not further evaluate the entire command using the name of the target.
  36.  
  37. In other words, whay you are really executing here is:
  38.  
  39.     put item 2 of "card field blort"
  40.  
  41. where "card field blort" is the actual data sent to the item function.  Since
  42. there are no commas in the string, you get nuttin'.  This does seem
  43. inconsistent when you consider that:
  44.  
  45.    get the loc of the target     - is equivalent to:
  46.    get the loc of card field "blort"
  47.  
  48. whereas...
  49.  
  50.     put item 2 of the target     - is NOT equivalent to:
  51.     put item 2 of card field "blort"
  52.  
  53. This seems to indicate that the expression "the target" is not to be consisered
  54. a MACRO, but an expression which is evaluated once.
  55.  
  56. In your field, try:
  57.  
  58.  on test
  59.     get the target
  60.     put it
  61.  end test
  62.  
  63. It will show the name of the field.  For my use, it seems like "the target"
  64. would have been more useful to evaluate to the contents, and require applying
  65. the function "get the name of the target" when that is what I want.
  66.  
  67. However, "the target" may also refer to buttons, which do not contain values,
  68. just properties.  Anyone know if there is a reasonable way to use "the target"
  69. in the case of a field to get the contents, other than using the "do" command
  70. on a string I build?
  71.  
  72.  
  73.  
  74. -- part contents for background part 45
  75. ----- text -----
  76. Re: the target